/*
 * Copyright (C) 2010 TopCoder Inc., All Rights Reserved.
 */
package com.hercules.xre.protocol.testing.handlers;

import java.awt.image.BufferedImage;

/**
 * This interface represents the contract for image serializer. It has only single method: saveImage(...) to save image
 * to file. It is used by {@link ScreenshotEventHandler} to write image to file
 * <p>
 * <b>Thread safety:</b> Implementation is required to be thread safe.
 *
 * @author bramandia, 7realm
 * @version 1.0
 */
public interface ImageSerializer {
    /**
     * Save the given image with the given output file to the given filename.
     *
     * @param image the image to save, must not be null
     * @param outputFormat the output type (e.g. "png", "jpg", etc), must not be null/empty
     * @param filename the output filename to save to, must not be null/empty
     * @throws IllegalArgumentException if any argument is invalid
     * @throws ImageSerializerException if there is any error occurred during image serialization
     */
    void serializeImage(BufferedImage image, String outputFormat, String filename) throws ImageSerializerException;
}
